Conversation
…Query pipeline (CLI-FA) Replaces the specific tryRepairQuery (catch-block-only, single regex) with a normalizeQuery pipeline that runs BEFORE PEG parsing on every query: 1. fixMismatchedBrackets: [a,b,) → [a,b] (wrong closing delimiter) 2. stripTrailingListCommas: [a,b,] → [a,b] (trailing comma in balanced brackets) 3. Whitespace collapse: double spaces → single, trim edges The pipeline architecture makes it easy to add more normalization passes (e.g., date format repair, quote balancing) without growing complexity. Pre-parse normalization is cheaper and more predictable than the previous approach of only repairing in the PEG failure catch block.
Contributor
|
Contributor
Codecov Results 📊✅ 6290 passed | Total: 6290 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 60.00%. Project has 13110 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 75.87% 75.91% +0.04%
==========================================
Files 294 294 —
Lines 54454 54412 -42
Branches 0 0 —
==========================================
+ Hits 41312 41302 -10
- Misses 13142 13110 -32
- Partials 0 0 —Generated by Codecov Action |
…collapse 1. MALFORMED_IN_LIST_RE now only matches ) as wrong closing delimiter, not ] (which is handled by stripTrailingListCommas). Removes the overlap between the two pipeline steps. 2. Removes whitespace collapse — it would alter content inside quoted values like message:"connection timed out". Addresses Cursor Bugbot medium + low severity findings.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b55cfb0. Configure here.
BYK
added a commit
that referenced
this pull request
Apr 29, 2026
…ing quoted values (#881) ## Summary Fixes a bug from PR #880 where `normalizeQuery` could corrupt quoted string content. Since the normalization pipeline runs on **every** query (not just PEG failures), bracket repairs like `[500,]` → `[500]` would also fire inside quoted values like `message:"error [500,] found"`. ## Fix Introduces `transformUnquoted()` — splits the query at double-quoted boundaries (respecting escaped quotes `\"`) and only applies normalization passes to unquoted segments. Quoted regions are preserved verbatim. ## Changes - **`src/lib/search-query.ts`**: Add `QUOTED_SEGMENT_RE`, `transformUnquoted()`, wrap `normalizeQuery` pipeline inside `transformUnquoted` - **`test/lib/search-query.test.ts`**: 10 new tests covering quote preservation, mixed quoted/unquoted repairs, escaped quotes, and `transformUnquoted` unit tests ## Examples | Input | Before this fix | After this fix | |---|---|---| | `message:"error [500,] found"` | `message:"error [500] found"` (corrupted) | `message:"error [500,] found"` (preserved) | | `level:[error,) message:"[trailing,]"` | both brackets fixed | only `level` fixed, quote preserved | Addresses #880 (comment)
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Follow-up to #872 — replaces the specific
tryRepairQuery(single regex, catch-block-only) with a genericnormalizeQuerypipeline that runs before PEG parsing on every query.What changed
Before (PR #872)
tryRepairQueryonly ran when PEG parsing failed (catch block)[a,b,)→[a,b][a,b,])After (this PR)
normalizeQueryruns on every query before PEG parsing — cheap string opsfixMismatchedBrackets:[a,b,)→[a,b](wrong closing delimiter)stripTrailingListCommas:[a,b,]→[a,b](balanced bracket trailing comma)Why pre-parse?
Only 1 of the observed CLI-FA patterns actually fails PEG parsing — the rest parse fine but the Sentry API rejects them semantically. Running normalization before parsing catches both syntactic and PEG-valid-but-API-invalid patterns.
Tests
sanitizeQuery→normalizeQuery→ PEG parse flow